package com.treeengine.game.texture;


/**
 * 
 * Class where we can specify pixel coordinates of an image in a texture atlas, 
 * which then stores the corresponding texture coordinates of the atlas region 
 * for further processing (for example, when we want to render a sprite). 
 * 
 * @author gustavo.freitas
 */
public class TextureRegion {    
    private final float u1, v1;
    private final float u2, v2;
    private final Texture texture;
    
    public TextureRegion(Texture texture, float x, float y, float width, float height) {
        this.u1 = x / texture.getWidth();
        this.v1 = y / texture.getHeight();
        this.u2 = this.u1 + width / texture.getWidth();
        this.v2 = this.v1 + height / texture.getHeight();        
        this.texture = texture;
    }

	public float getU1() {
		return u1;
	}

	public float getV1() {
		return v1;
	}

	public float getU2() {
		return u2;
	}

	public float getV2() {
		return v2;
	}

	public Texture getTexture() {
		return texture;
	}
    
    
}
